package schoolEmployeeTest;

import java.util.*;

public class meituan2 {
    static long money = 1000;
    static int gushu = 0; //买的股数
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] prices = new int[n];
        for (int i=0; i<n; i++) {
            prices[i] = scanner.nextInt();
        }
        System.out.println(maxProfit(prices));
    }

    public static long maxProfit(int[] prices) {
        int n = prices.length;
        if (n < 2)  return money;
        for (int i = 1; i < n; i++) {
            if (prices[i] > prices[i - 1]) {
                gushu = (int) money / prices[i-1];
                money += gushu * (prices[i]-prices[i-1]);

            }
        }
        if (money >= 1000000) {
            return 1000000;
        } else {
            return money;
        }
    }
}
